/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trunk.view.tool;

import java.awt.Dimension;
import javax.swing.JButton;
import trunk.model.EDrawTool;

/**
 * Class ToolButton 
 * 
 * Components representant un bouton de selection d'outil
 * 
 * @author LEFEVRE Michael
 * @author THOUE Jonathan
 */
public class ToolButton extends JButton{
    
    private EDrawTool tool;
    /**
     * Constructeur de la classe
     * @param tool - Outils correspondant au bouton
     */      
    public ToolButton(EDrawTool tool) {
        this.tool = tool;
        setPreferredSize(new Dimension(25, 25));
        if(tool ==EDrawTool.POINT){
            this.setText(".");
            this.setToolTipText("Draw a pixel.");
        }else if(tool ==EDrawTool.SEGMENT){
            this.setText("/");
            this.setToolTipText("Draw a segment.");
        }else if(tool ==EDrawTool.POLYGON){
            this.setText("\u0394");
            this.setToolTipText("Draw a polygon.");
        }else if(tool ==EDrawTool.CIRCLE){
            this.setText("\u039F");
            this.setToolTipText("Draw a circle.");
        }else if(tool ==EDrawTool.RECTANGLE){
            this.setText("\u25FB");
            this.setToolTipText("Draw a rectangle.");
        }else if(tool ==EDrawTool.SELECT){
            this.setText("S");
            this.setToolTipText("Selection Mode");
        }else if(tool ==EDrawTool.AXE){
            this.setText("+");
            this.setToolTipText("Change Axe/Origine");
        }
    }
    /**
     * Get Tool
     * @return l'outil correspondant au bouton
     */
    public EDrawTool getTool() {
        return tool;
    }
    
}
